<template>
  <div>
    <input v-model="question" placeholder="请输入你的问题" />
    <button @click="submitQuestion">提交问题</button>
  </div>
</template>

<script setup>
import { ref, defineEmits } from 'vue';

const question = ref('');
const emits = defineEmits(['ask-question']);

const submitQuestion = () => {
  if (!question.value.trim()) {
    return;
  }
  emits('ask-question', question.value);
  question.value = '';
};
</script>